package com.th.supcom.pds.config.client.common;

/**
 * 启用禁用枚举.
 */
public enum PdsConfigExistEnum
{
    /**
     * 有 (value = 1)
     */
    Exist (1, "有"),

    /**
     * 无 (value = 0)
     */
    NotExist (0, "无");

    /** 公司版权信息. */
    public static final String copyright = "Copyright 2014, TH Supcom Corporation";
    /** 提交路径. */
    public static final String SCC_BRANCH = "$URL$";

    /** 提交日期. */
    public static final String SCC_LAST_MODIFICATION_DATE = "$Date$";

    /** 最终修改人员. */
    public static final String SCC_LAST_MODIFIER_NAME = "$Author$";

    /** 最终版本号. */
    public static final String SCC_REVISION = "$Revision$";

    public static PdsConfigExistEnum getConfigExistEnumByCode (final int code)
    {
        for (final PdsConfigExistEnum en : PdsConfigExistEnum.values ())
        {
            if (en.getCode () == code)
            {
                return en;
            }
        }
        throw new RuntimeException ("找不到code【" + code + "】对应的PtsEnableEnum枚举!");
    }

    public static String getConfigExistNameByValue (final Integer value)
    {
        if (value == null)
        {
            return "";
        }
        switch (value)
        {
            case 1:
                return PdsConfigExistEnum.Exist.getName ();
            case 0:
                return PdsConfigExistEnum.NotExist.getName ();
            default:
                return "--";
        }
    }

    private int m_code;

    private String m_enable;

    private PdsConfigExistEnum (final int code, final String enable)
    {
        this.m_code = code;
        this.m_enable = enable;
    }

    public int getCode ()
    {
        return this.m_code;
    }

    public String getName ()
    {
        return this.m_enable;
    }
}
